/*
 * @filename CustomSpringApplicationRunListener.java
 * @author barry
 * @version 0.0.1
 * @date 2020年4月5日
 */
package com.bnzj.cloud.config;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.core.env.ConfigurableEnvironment;

import com.bnzj.core.util.SpringUtils;

/**
 * Spring启动监听器
 * @author barry
 * @date 2020-04-05
 */
public class CustomSpringApplicationRunListener implements SpringApplicationRunListener {
    
    private final SpringApplication springApplication;
    private final String[] args;

    public CustomSpringApplicationRunListener(SpringApplication springApplication, String[] args) {
        this.springApplication = springApplication;
        this.args = args;
    }

    @Override
    public void environmentPrepared(ConfigurableEnvironment environment) {
        SpringUtils.setEnvironment(environment);
    }

    public SpringApplication getSpringApplication() {
        return springApplication;
    }

    public String[] getArgs() {
        return args;
    }
}
